// index.js
Page({
  data: {
    isDialog_location: false,
    isDialog_select: false,
    isDialog_select_index: 0,
    bannerList: [],
    bannerImg: {},
    statusBarHeight: "",
    statusBar: {},
    statusBarColor: "transparent",
    typeList: [{
        label: "本小区",
        value: 1
      },
      {
        label: "附近小区",
        value: 2
      }
    ],
    community: {
      title: "请定位小区"
    },
    community_mini: [],
    typeValue: 1,
    list: [{
      "id": 210,
      "postId": null,
      "userId": 262,
      "userName": "宋亚楠",
      "userAvatar": "",
      "type": 2,
      "typeName": null,
      "title": "宝宝床",
      "content": "贝利婴幼儿床，九九成新，买回来孩子没怎么用，蚊帐，床垫都是新的，价位可以再商量",
      "price": 200.00,
      "stock": 1,
      "saleStatus": 1,
      "rentType": null,
      "rentMethod": null,
      "parkingFloor": null,
      "parkingType": null,
      "payMethod": null,
      "labelIds": "8,12",
      "labelNames": "小区自提,自家售卖",
      "imgIds": "583",
      "imgUrls": "http://linxiaobang.oss-accelerate.aliyuncs.com/img/202205/2eedd932-d5ae-4027-a631-fdbca502248d.jpg",
      "lookUp": 57,
      "thumbsUp": 0,
      "isThumbsUp": 0,
      "communityAuth": 0,
      "takeOrderAuth": 0,
      "createTime": 1653467134006,
      "createTimeStr": "7小时前",
      "beginTime": null,
      "endTime": 1987430400000,
      "beginTimeStr": null,
      "endTimeStr": "2032-12-24 00:00",
      "remainingTimeStr": "3864天23小时35分钟"
    }, {
      "id": 209,
      "postId": null,
      "userId": 2,
      "userName": "\uD83D\uDE34",
      "userAvatar": "https://thirdwx.qlogo.cn/mmopen/vi_32/DYAIOgq83erS4T2ATdcLficzt4d3icrcbkrOnZH0gZa1HQKx0peiaKQZT22aS06aPScNs8zmP0nu4icicIQDkUCM6fA/132",
      "type": 2,
      "typeName": null,
      "title": "2021款防晒墨镜玳瑁框",
      "content": "2021款的墨镜，玳瑁框黑镜片，戴过几次，现在出二手，15块钱周末自提",
      "price": 15.00,
      "stock": 1,
      "saleStatus": 1,
      "rentType": null,
      "rentMethod": null,
      "parkingFloor": null,
      "parkingType": null,
      "payMethod": null,
      "labelIds": "8,11,10",
      "labelNames": "小区自提,限时特价,质量保证",
      "imgIds": "568",
      "imgUrls": "http://linxiaobang.oss-accelerate.aliyuncs.com/img/202205/13724ff0-89ed-4ee9-9a27-90a6a7a99baf.jpg",
      "lookUp": 40,
      "thumbsUp": 0,
      "isThumbsUp": 0,
      "communityAuth": 0,
      "takeOrderAuth": 1,
      "createTime": 1653449966861,
      "createTimeStr": "12小时前",
      "beginTime": null,
      "endTime": 1654002000000,
      "beginTimeStr": null,
      "endTimeStr": "2022-05-31 21:00",
      "remainingTimeStr": "5天20小时35分钟"
    }, {
      "id": 208,
      "postId": null,
      "userId": 10,
      "userName": "孟加伟",
      "userAvatar": "https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTLKmEI3YQhgUldQKBOibDvrV3L5o2TSZiaibiaib6zREia8mVbib0O30gjdbAp1ic68BY7ZT7yZwDyMVVTmTA/132",
      "type": 1,
      "typeName": null,
      "title": "为了饭团，200饭团=20个鸡蛋，10个饭团=1个鸡蛋，没毛病\uD83D\uDE0B\uD83D\uDE0B\uD83D\uDE0B",
      "content": "为了饭团，200饭团=20个鸡蛋，10个饭团=1个鸡蛋，没毛病\uD83D\uDE0B\uD83D\uDE0B\uD83D\uDE0B",
      "price": null,
      "stock": null,
      "saleStatus": 1,
      "rentType": null,
      "rentMethod": null,
      "parkingFloor": null,
      "parkingType": null,
      "payMethod": null,
      "labelIds": null,
      "labelNames": null,
      "imgIds": "",
      "imgUrls": null,
      "lookUp": 19,
      "thumbsUp": 1,
      "isThumbsUp": 0,
      "communityAuth": 1,
      "takeOrderAuth": 1,
      "createTime": 1653449390407,
      "createTimeStr": "12小时前",
      "beginTime": null,
      "endTime": null,
      "beginTimeStr": null,
      "endTimeStr": null,
      "remainingTimeStr": null
    }, {
      "id": 207,
      "postId": null,
      "userId": 74,
      "userName": "沂水行歌",
      "userAvatar": "https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJlnvVBN1uUEZJB7g5cAWteYJZxPUHqhVnYYDxxO9BicLqCWQNF4mG1e17nzTJs8ibibqDxwDNaD6xKw/132",
      "type": 7,
      "typeName": null,
      "title": "免费债务规划",
      "content": "法务公司 售后无忧\n1：信用卡逾期停息挂账（免息分期60期 逾期罚息减免 停催）\n2：保险退费（所有险种 不想交均可退回）\n3：支付宝 微粒贷、平安普惠等网贷延期还款 二次分期 减免结清等等\n4：征信不良记录永久修复（可贷款）\n5：信用卡最低还款利息 年费 分期手续费追回（不伤卡）\n电话：15638918913（微信）",
      "price": null,
      "stock": null,
      "saleStatus": 1,
      "rentType": null,
      "rentMethod": null,
      "parkingFloor": null,
      "parkingType": null,
      "payMethod": null,
      "labelIds": null,
      "labelNames": null,
      "imgIds": "559",
      "imgUrls": "http://linxiaobang.oss-accelerate.aliyuncs.com/img/202205/13158ce2-6ae1-4abc-b8ac-770a5241ebac.jpg",
      "lookUp": 36,
      "thumbsUp": 0,
      "isThumbsUp": 0,
      "communityAuth": 1,
      "takeOrderAuth": 0,
      "createTime": 1653404554932,
      "createTimeStr": "昨天 23:02",
      "beginTime": null,
      "endTime": null,
      "beginTimeStr": null,
      "endTimeStr": null,
      "remainingTimeStr": null
    }, {
      "id": 206,
      "postId": null,
      "userId": 26,
      "userName": "颖川百墨谷～何涛",
      "userAvatar": "https://thirdwx.qlogo.cn/mmopen/vi_32/NhzcRGibG6kwjupI6oJ2fUSRCUzggYlpTX3JibibibeFLAl6LavYmOW4EeicqibUnkJoOwl8HBhmTu6JaiatZIiakjZtnw/132",
      "type": 7,
      "typeName": null,
      "title": "小儿推拿馆",
      "content": "小儿日常保健推拿，脾胃调理，鼻炎调理，便秘调理，视力矫正，感冒，咳嗽，发热，腹泻等调理\n成人颈肩腰腿疼推拿\n艾灸，拔罐，刮痧\n梧桐街与石楠路交叉口向南50米德坤堂大药房二楼",
      "price": null,
      "stock": null,
      "saleStatus": 1,
      "rentType": null,
      "rentMethod": null,
      "parkingFloor": null,
      "parkingType": null,
      "payMethod": null,
      "labelIds": null,
      "labelNames": null,
      "imgIds": "554",
      "imgUrls": "http://linxiaobang.oss-accelerate.aliyuncs.com/img/202205/9deb0e96-efc4-4772-931f-b3057c2aa25b.jpg",
      "lookUp": 90,
      "thumbsUp": 0,
      "isThumbsUp": 0,
      "communityAuth": 1,
      "takeOrderAuth": 1,
      "createTime": 1653388938113,
      "createTimeStr": "昨天 18:42",
      "beginTime": null,
      "endTime": null,
      "beginTimeStr": null,
      "endTimeStr": null,
      "remainingTimeStr": null
    }, {
      "id": 205,
      "postId": null,
      "userId": 355,
      "userName": "初心",
      "userAvatar": "https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJvxTO5l5tNHXcZYKqoqIgl1k990uKlIm7xcbDXfBCoLgia8pkxpY8ctT6bzqJXZe48DZ88VTp7VTQ/132",
      "type": 5,
      "typeName": null,
      "title": "三菱奥德赛七座",
      "content": "18年12月入手，急需资金忍痛出售，诚心需要者可看车。因此平台价格限制问题，只能标注1万元，实际售价150000元。请看仔细哦。",
      "price": 9999.00,
      "stock": 1,
      "saleStatus": 1,
      "rentType": null,
      "rentMethod": null,
      "parkingFloor": null,
      "parkingType": null,
      "payMethod": null,
      "labelIds": "",
      "labelNames": null,
      "imgIds": "548,549,550,551,552",
      "imgUrls": "http://linxiaobang.oss-accelerate.aliyuncs.com/img/202205/e48235b6-01f2-4130-9bcc-047fc3348b8b.jpg,http://linxiaobang.oss-accelerate.aliyuncs.com/img/202205/ffb79279-bcbb-478f-8ef8-1ff45afb4ec3.jpg,http://linxiaobang.oss-accelerate.aliyuncs.com/img/202205/85cb4b30-0fa9-4cf3-8014-8d783b2836fd.jpg,http://linxiaobang.oss-accelerate.aliyuncs.com/img/202205/95f62b81-f3c1-4b8f-aec2-d516f5435df4.jpg,http://linxiaobang.oss-accelerate.aliyuncs.com/img/202205/998e19ab-ba0e-4978-8424-c5ef0b00014c.jpg",
      "lookUp": 130,
      "thumbsUp": 0,
      "isThumbsUp": 0,
      "communityAuth": 0,
      "takeOrderAuth": 0,
      "createTime": 1653372121200,
      "createTimeStr": "昨天 14:02",
      "beginTime": null,
      "endTime": 1656518400000,
      "beginTimeStr": null,
      "endTimeStr": "2022-06-30 00:00",
      "remainingTimeStr": "34天23小时35分钟"
    }, {
      "id": 204,
      "postId": null,
      "userId": 355,
      "userName": "初心",
      "userAvatar": "https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJvxTO5l5tNHXcZYKqoqIgl1k990uKlIm7xcbDXfBCoLgia8pkxpY8ctT6bzqJXZe48DZ88VTp7VTQ/132",
      "type": 5,
      "typeName": null,
      "title": "博士有成儿童学习桌椅",
      "content": "正品收货后发现不是我要的粉色，考虑节约物流费用，快速处理。仅一台仅限今明两天。",
      "price": 4000.00,
      "stock": 1,
      "saleStatus": 1,
      "rentType": null,
      "rentMethod": null,
      "parkingFloor": null,
      "parkingType": null,
      "payMethod": null,
      "labelIds": "18",
      "labelNames": "小区自提",
      "imgIds": "544,546,547",
      "imgUrls": "http://linxiaobang.oss-accelerate.aliyuncs.com/img/202205/a2d32e97-db60-4920-9ef8-a9777f60d5e6.jpg,http://linxiaobang.oss-accelerate.aliyuncs.com/img/202205/0e499f06-e2b5-4d0c-8b99-118fe90b5292.unknown,http://linxiaobang.oss-accelerate.aliyuncs.com/img/202205/4d475eff-637a-4960-9994-744afaa1185b.jpg",
      "lookUp": 78,
      "thumbsUp": 0,
      "isThumbsUp": 0,
      "communityAuth": 0,
      "takeOrderAuth": 0,
      "createTime": 1653371824550,
      "createTimeStr": "昨天 13:57",
      "beginTime": null,
      "endTime": 1653454800000,
      "beginTimeStr": null,
      "endTimeStr": "2022-05-25 13:00",
      "remainingTimeStr": "已过期"
    }, {
      "id": 203,
      "postId": null,
      "userId": 168,
      "userName": "郭云鹏",
      "userAvatar": "https://thirdwx.qlogo.cn/mmopen/vi_32/MzfKJP8K6qQAfIDl80YJjsDYOgtmYQhDhjMh4vR8UaICz9CcIpUQs7nhvVDsnt3N5icF6cQKU6t8tKxX2VKDSDQ/132",
      "type": 1,
      "typeName": null,
      "title": "好消息!好消息!好消息!\t[庆祝][庆祝][庆祝]\n河南梦幻汽修有限公司（新店开业化工路店  双店齐庆）[烟花][烟花][烟花]\n29.9元抢购718元养车大礼包[礼物][礼物]\n标准洗车两次 价值80元\n空调冷媒一罐 价值60元\n空调杀菌消毒1次 价值120元\n发动机舱清洗一次 价值120元\n节气门清洗一次 价值100元\n5公里道路救援一次 价值100元\n审车代金券一张 价值100元\n进店激活:领取价值38元精品车载收纳箱一个\n尊享99元更换空调冷媒一次\n领取时间:2022年5月27日-5月31日\n咨询电话:\n15515816988/17596487114\n\n万科城店地址:高新区紫竹路玉兰街93号\n化工路店地址:郑州高新区化工路1号楼1单元101\n激活领取请到化工路店[礼物][礼物][礼物]",
      "content": "好消息!好消息!好消息!\t[庆祝][庆祝][庆祝]\n河南梦幻汽修有限公司（新店开业化工路店  双店齐庆）[烟花][烟花][烟花]\n29.9元抢购718元养车大礼包[礼物][礼物]\n标准洗车两次 价值80元\n空调冷媒一罐 价值60元\n空调杀菌消毒1次 价值120元\n发动机舱清洗一次 价值120元\n节气门清洗一次 价值100元\n5公里道路救援一次 价值100元\n审车代金券一张 价值100元\n进店激活:领取价值38元精品车载收纳箱一个\n尊享99元更换空调冷媒一次\n领取时间:2022年5月27日-5月31日\n咨询电话:\n15515816988/17596487114\n\n万科城店地址:高新区紫竹路玉兰街93号\n化工路店地址:郑州高新区化工路1号楼1单元101\n激活领取请到化工路店[礼物][礼物][礼物]",
      "price": null,
      "stock": null,
      "saleStatus": 1,
      "rentType": null,
      "rentMethod": null,
      "parkingFloor": null,
      "parkingType": null,
      "payMethod": null,
      "labelIds": null,
      "labelNames": null,
      "imgIds": "543",
      "imgUrls": "http://linxiaobang.oss-accelerate.aliyuncs.com/img/202205/95634856-218c-41c5-a9ae-3c05264bb5d1.jpg",
      "lookUp": 29,
      "thumbsUp": 0,
      "isThumbsUp": 0,
      "communityAuth": 0,
      "takeOrderAuth": 0,
      "createTime": 1653365657517,
      "createTimeStr": "昨天 12:14",
      "beginTime": null,
      "endTime": null,
      "beginTimeStr": null,
      "endTimeStr": null,
      "remainingTimeStr": null
    }, {
      "id": 202,
      "postId": null,
      "userId": 77,
      "userName": "嘿爱你寿司祝福红城店",
      "userAvatar": "http://linxiaobang.oss-accelerate.aliyuncs.com/img/202205/5009fd9f-91a9-4427-9c93-8f4a73ef508d.jpg",
      "type": 2,
      "typeName": null,
      "title": "鲜寿司套餐",
      "content": "肉松、鱼籽、海草军舰\n鲜虾、鳗鱼握\n加州寿司",
      "price": 22.00,
      "stock": 1000,
      "saleStatus": 1,
      "rentType": null,
      "rentMethod": null,
      "parkingFloor": null,
      "parkingType": null,
      "payMethod": null,
      "labelIds": "8,11",
      "labelNames": "小区自提,质量保证",
      "imgIds": "541",
      "imgUrls": "http://linxiaobang.oss-accelerate.aliyuncs.com/img/202205/9de40de2-860b-445a-afba-9bbebcb0cfe3.jpg",
      "lookUp": 71,
      "thumbsUp": 0,
      "isThumbsUp": 0,
      "communityAuth": 0,
      "takeOrderAuth": 0,
      "createTime": 1653358848479,
      "createTimeStr": "昨天 10:20",
      "beginTime": null,
      "endTime": 1654012800000,
      "beginTimeStr": null,
      "endTimeStr": "2022-06-01 00:00",
      "remainingTimeStr": "5天23小时35分钟"
    }, {
      "id": 201,
      "postId": null,
      "userId": 77,
      "userName": "嘿爱你寿司祝福红城店",
      "userAvatar": "http://linxiaobang.oss-accelerate.aliyuncs.com/img/202205/5009fd9f-91a9-4427-9c93-8f4a73ef508d.jpg",
      "type": 2,
      "typeName": null,
      "title": "烤鳗虾卷",
      "content": "内包有芙蓉虾，外鳗鱼覆盖，味道鲜香酥脆",
      "price": 18.00,
      "stock": 1000,
      "saleStatus": 1,
      "rentType": null,
      "rentMethod": null,
      "parkingFloor": null,
      "parkingType": null,
      "payMethod": null,
      "labelIds": "8,11",
      "labelNames": "小区自提,质量保证",
      "imgIds": "540",
      "imgUrls": "http://linxiaobang.oss-accelerate.aliyuncs.com/img/202205/13e63c14-c2d1-458d-908b-a7a4fbaf65ba.jpg",
      "lookUp": 90,
      "thumbsUp": 0,
      "isThumbsUp": 0,
      "communityAuth": 0,
      "takeOrderAuth": 0,
      "createTime": 1653350708183,
      "createTimeStr": "昨天 08:05",
      "beginTime": null,
      "endTime": 1654012800000,
      "beginTimeStr": null,
      "endTimeStr": "2022-06-01 00:00",
      "remainingTimeStr": "5天23小时35分钟"
    }],
    page: 1,
    size: 10,
    isNoMore: true,
    isLoding: true,
    isDialog_newuser: false
  },
  bannerLoad(e) {
    this.setData({
      bannerImg: {
        width: e.detail.width,
        height: e.detail.height
      }
    });
  },
  // 获取滚动条当前位置
  onPageScroll(e) {
    if (e.scrollTop > 0) {
      this.setData({
        statusBarColor: "#ffffff"
      });
    } else {
      this.setData({
        statusBarColor: "transparent"
      });
    }
  },
  onLoad() {
    wx.getSystemInfo({
      success: res => {
        this.setData({
          statusBarHeight: res.statusBarHeight,
          statusBar: wx.getMenuButtonBoundingClientRect()
        });
      }
    });
    this.getBanner();
    // 未登录状态
    if (!!wx.getStorageSync("token")) {
      this.setData({
        list: []
      });
    }
    this.getList();

    // 通用数据获取
    getApp().globalData.http.getBaseSelectOption({
      type: 1
    }).then(res => {
      wx.setStorageSync("ageList", res.data);
    });
    getApp().globalData.http.getBaseSelectOption({
      type: 2
    }).then(res => {
      wx.setStorageSync("jobList", res.data);
    });
    getApp().globalData.http.getBaseSelectOption({
      type: 3
    }).then(res => {
      wx.setStorageSync("taskList", res.data);
    });
    getApp().globalData.http.getBaseSelectOption({
      type: 4
    }).then(res => {
      wx.setStorageSync("WCList", res.data);
    });
    getApp().globalData.http.getBaseSelectOption({
      type: 5
    }).then(res => {
      wx.setStorageSync("QQList", res.data);
    });

    if (wx.getStorageSync("firstLogin")) {
      setTimeout(() => {
        this.setData({
          isDialog_newuser: true
        });
      }, 1000);
    }
  },
  onShow() {
    if (typeof this.getTabBar === 'function' && this.getTabBar()) {
      this.getTabBar().setData({
        selected: 0
      });
    }

    // 已登录
    if (!!wx.getStorageSync("token")) {
      // 获取用户当前小区
      this.getUserCommunity();
      // 获取用户授权信息
      wx.getSetting({
        success: (res) => {
          console.log("授权信息", res.authSetting)
          if (!res.authSetting["scope.userLocation"] && res.authSetting["scope.userLocation"] != undefined) {
            this.setData({
              isDialog_location: false
            });
            getApp().globalData.vant.dialog.confirm({
              title: "温馨提示",
              message: "位置授权是为了给您定位居住小区，确保小区及人员信息的真实安全~",
              showCancelButton: false,
              confirmButtonText: "授权登录",
              confirmButtonOpenType: "openSetting"
            }).then(() => {});
          } else {
            this.setData({
              isDialog_location: true,
              isDialog_select: false
            });
          }
        },
        fail: () => {}
      });
    }
  },
  onShareAppMessage() {
    return {
      title: "邻小帮本地生活服务",
      imageUrl: "https://www.linxiaobang.com.cn/miniprogram/image/share.jpg",
    }
  },
  onPullDownRefresh() {
    if (!!wx.getStorageSync("token")) {
      wx.showNavigationBarLoading();
      this.reset();
    } else {
      wx.stopPullDownRefresh();
    }
  },
  reset() {
    this.setData({
      page: 1,
      list: [],
      isNoMore: true,
      isLoding: true,
    });
    this.getList();
  },
  sel_community_mini(e) {
    this.setData({
      isDialog_select_index: e.currentTarget.dataset.index
    });
  },
  bannerHandle(e) {
    let type = e.currentTarget.dataset.type;
    let url = "";
    if (type == 1) {
      url = "/pages/common/webview/webview?url=" + e.currentTarget.dataset.url
    } else if (type == 2) {
      url = e.currentTarget.dataset.url;
    }
    wx.navigateTo({
      url: url,
    });
  },
  navTo(e) {
    wx.navigateTo({
      url: e.currentTarget.dataset.path,
    });
  },
  switchTab(e) {
    wx.switchTab({
      url: e.currentTarget.dataset.path
    });
  },
  newuserClick() {
    wx.removeStorageSync("firstLogin");
    this.setData({
      isDialog_newuser: false
    }, () => {
      wx.switchTab({
        url: "/pages/morejob/list/list",
        success: function (e) {
          var page = getCurrentPages().pop();
          if (page == undefined || page == null) return;
          page.onLoad();
        }
      });
    });
  },
  switchType(e) {
    this.setData({
      typeValue: e.currentTarget.dataset.value,
      list: []
    });
    this.getList();
  },
  confirmSelect() {
    getApp().globalData.http.saveCommunity({
      data: JSON.stringify(this.data.community_mini[this.data.isDialog_select_index])
    }).then(res => {
      getApp().globalData.vant.toast("保存成功");
      this.setData({
        isDialog_select: false,
        community: this.data.community_mini[this.data.isDialog_select_index]
      });
      this.getList();
    });
  },
  getBanner() {
    getApp().globalData.http.banner().then(res => {
      this.setData({
        bannerList: res.data
      });
    });
  },
  getUserCommunity() {
    getApp().globalData.http.getUserCommunity().then(data => {
      if (!data.data) {
        setTimeout(() => {
          wx.getLocation({
            type: "gcj02",
            success: (e) => {
              getApp().globalData.http.getCommunity({
                keyword: "小区",
                boundary: `nearby(${e.latitude},${e.longitude},1000,0)`,
                filter: "category=住宅区,住宅小区,其它住宅区",
                orderby: "_distance",
                page_size: 20
              }).then(res => {
                this.setData({
                  community_mini: res.data,
                  isDialog_select: true
                });
              });
            },
            fail: () => {}
          });
        })
      } else {
        this.setData({
          community: data.data
        });
      }
    });
  },
  getList() {
    let params = {
      page: this.data.page,
      size: this.data.size,
      communityId: "",
      type: "",
      createTime: this.data.page == 1 ? "" : this.data.list[this.data.list.length - 1].createTime,
      id: this.data.page == 1 ? "" : this.data.list[this.data.list.length - 1].id,
      pageType: 1
    };

    if (this.data.typeValue == 1) {
      params.communityId = this.data.community.id;
    } else if (this.data.typeValue == 2) {
      params.communityId = this.data.community.id;
    } else if (this.data.typeValue == 3) {
      params.type = 4;
    }
    getApp().globalData.http.list(params).then(res => {
      wx.stopPullDownRefresh();
      wx.hideNavigationBarLoading();
      let data_tmp = [...this.data.list, ...res.data];
      this.setData({
        list: data_tmp,
        isLoding: true
      });
      if (res.count == 0) {
        this.setData({
          isNoMore: false
        });
      }
    });
  },
  onReachBottom() {
    if (!!wx.getStorageSync("token") && this.data.isNoMore) {
      this.setData({
        page: this.data.page / 1 + 1,
        isLoding: false
      });
      this.getList();
    }
  },
  thumbup(e) {
    getApp().globalData.http.thumbup({
      id: e.currentTarget.dataset.id
    }).then(res => {
      this.setData({
        ["list[" + e.currentTarget.dataset.index + "].isThumbsUp"]: 1,
        ["list[" + e.currentTarget.dataset.index + "].thumbsUp"]: this.data.list[e.currentTarget.dataset.index].thumbsUp / 1 + 1,
      });
    });
  },
  thumbupList(e) {
    wx.navigateTo({
      url: "/pages/my/likedlist/likedlist?id=" + e.currentTarget.dataset.id,
    });
  },
  previewImg(e) {
    let arr = e.currentTarget.dataset.img;
    let current = e.currentTarget.dataset.current;
    getApp().globalData.util.previewImage(arr, current);
  }
})